package sample;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.AnchorPane;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;

public class Controller implements Initializable {
    @FXML
    public WebView webView;
    @FXML
    public Button btn_settingRouter;

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        final WebEngine webengine = webView.getEngine();
        String url = Main.class.getResource("/sample/html/index.html").toExternalForm();
        webengine.load(url);
    }
    @FXML
    public void startCapture(ActionEvent event) throws IOException {
        AnchorPane settings = FXMLLoader.load(getClass().getResource("Stage2/settingRouter.fxml"));
        Stage settingsStage = new Stage();
        settingsStage.setTitle("配置");
        settingsStage.setMaximized(true);
//        settingsStage.initStyle(StageStyle.UNDECORATED); // 则窗口不会显示标题栏。
        settingsStage.setScene(new Scene(settings));
        settingsStage.show();
    }
}
